package current.security.user.domain;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Proxy;


@Entity(name="Role")
@Table(name="TBL_ROLE")
@Proxy(lazy = false)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Role {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GenericGenerator(name="idGenerator", strategy="uuid") //这个是hibernate的注解
	@GeneratedValue(generator="idGenerator") //使用uuid的生成策略
	private String id;
	
	private String name;
	
	private String cname;

	private String memo;
	
	private String dflag;
	
	//角色集合列表
	 //mappedBy 说明User不负责维护关系
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,mappedBy="role")
	private Set<U_Role> users;
	 //mappedBy 说明User不负责维护关系
    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY,mappedBy="role")
	private Set<R_Resc> rescs = new HashSet<R_Resc>();
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
 
	public String getCname() {
		return cname;
	}

	public void setCname(String cname) {
		this.cname = cname;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}
	public Set<U_Role> getUsers() {
		return users;
	}

	public void setUsers(Set<U_Role> users) {
		this.users = users;
	}
	public Set<R_Resc> getRescs() {
		return rescs;
	}

	public void setRescs(Set<R_Resc> rescs) {
		this.rescs = rescs;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getDflag() {
		return dflag;
	}

	public void setDflag(String dflag) {
		this.dflag = dflag;
	}

}
